home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
comm
/
tlx_sq15.zip
/
MBBS.SLT
< prev
next >
Wrap
Text File
|
1991-01-24
|
17KB
|
464 lines
//-----------------------------------------------------------
// MBBS.SL? Automatic logging into an MBBS system.
//
// Please look at the comments through the whole file, and modify to
// suit your needs, BEFORE you use it. Then recompile with CS MBBS.
// Note: Lines commented out with //!! are not used in this script,
// but in other, related ones. Please don't delete them; they may
// become useful later.
//-----------------------------------------------------------
str thisBBStype[] = "MBBS" // This BBS type.
,line [80] // General input line.
,filelist [12] // Name of file list for this BBS.
,myprot [2] // Chosen protocol.
,hisprot [2] // MBBS's translation.
// For the Global storage:
,global []="GLOBAL" // Global script.
,bbstype []="BTYPE" // BBS type.
,short []="SHORT" // Short BBS name.
,hprot []="HPROT" // MBBS's interpretation of protocol
,prompt []="PROMPT" // Current prompt (global name)
,filist []="FILIST" // Name of file list.
,mscript []="MDOOR" // Name of mail door.
,mailup []="MAILUP" // Name of upload mail script.
,command[10] // Current prompt (value)
;
int y=4 // Y coordinate for messages
,tol = 300 // No activity for 30 seconds
,t1, t2, t3, t4, t5, t6, t7 // makes script time out.
,stat, tmark
,messages // Messages to fetch?
,nocon // No conference status.
;
//-----------------------------------------------------------
// Script starts here.
//-----------------------------------------------------------
main()
{
int filter
,i, l
,mo
,FTD // Files to Download
,eol1, eol2, eol3
,dlfile
,error
;
entry(); // Updates colors & status bar.
// Only if online.
if (!carrier())
{ failtone();
status_wind ("THIS SCRIPT ONLY WORKS IF YOU'RE ONLINE!",20);
return (-1);
}
read (bbstype,line); // Get current BBS type.
if (line != thisBBStype)
{ wrongBBS(); // Doesn't match script!
return (-1);
}
// Start tracking.
t1 = track ("Command:",0); // Track command.
t2 = track ("Kommando",0); // Norwegian.
t3 = 0; // Not used yet.
mo = track ("--more--", 0);
FTD = track ("private file",0); // Private files to download
// NB: Must differentiate between
nocon = 0; // the two below:
eol1 = track ("ence Status",0); // End of list 1
eol2 = track ("ges in conf",0); // End of list 2
eol3 = track ("ence status",0); // End of list 3
read (filist,filelist); // Get name of file list.
tmark = timer_start (tol); // Wait a minute for login
while ((stat=trig()) > 0) // Check for files to download.
{ if (stat == FTD) // Files to download?
{ track_free(stat);
FTD = 0;
read (short,line); // Get short BBS name.
strcat (line,".DL"); // Add DL extension.
t3 = track ("^J"); // Start tracking linefeeds.
i = -1; // Not first line!
dlfile = fopen (line,"a"); // Try open <BBS>.DL
}
else if (stat == t1) // Command?
goto proceed; // Something lost here!
else if (stat == t2) // Norwegian command???
english(); // Redefine to English.
else if (stat == t3) // File to download?
{ if (++i) // So log this line.
{ track_free (stat); // Stop tracking.
terminal();
vgetchrs(0,gety()-1,line,0,80); // Get previous line.
l=strlen(line);
while (1)
{ if (--l < 0) goto ignore; // All blanks. Ignore.
if (subchr(line,l) > ' ') // Get rid of trailing blanks.
break;
}
setchr (line,++l,0); // Terminate line.
fputs (line,dlfile); // Write it to file.
fputs ("^M^J",dlfile);
ignore: continue; // Continue loop.
}
}
else if (stat==eol1 || stat==eol2) // Conference Status:
goto proceed; // "Good" breakout.
else if (stat == eol3) // Info conference status:
{ nocon = 1; // Conference Status
goto proceed; // not displayed.
}
else if (stat == mo) // MORE? Just stop this for now.
cputs ("N^M");
}
if (!carrier()) return (-1);
proceed:
release(); // Release tracks and timer.
if (dlfile) fclose(dlfile); // Close .dl file if open.
messages = 0; // Preset to no messages.
t1 = track ("<0> new m",0); // No messages.
t2 = track ("No new me",0); // No message.
t3 = track ("w message",0); // One or more message.
t4 = track ("? for menu)",0); // Command (non-expert)
t5 = track ("Command:",0); // Command (Expert)
t6 = track ("Kommando",0); // Norwegian????
t7 = track ("--more--",0);
tmark = timer_start (tol); // Give me a minute.
while ((stat=trig()) > 0) // Check for messages.
{ if (stat==t1 || stat==t2) // No message: Subtract one because
--messages; // t3 triggers on this one too.
else if (stat == t3) // Any message:
{ ++messages; // Yes, add up mess. counter.
track_free(t1); // Now ignore "<0> new messages"
track_free(t2); // and "No new messages".
}
else if (stat == t4) // Non-expert?
{ cputs ("U X E^M"); // Tell him I'm an expert!
track_free(stat); // Release this tracking.
}
else if (stat == t5) // Main command
goto NextCommand;
else if (stat == t6) // Norwegian commands????
english(); // Redefine to English.
else if (stat == t7)
cputs ("N^M"); // MORE? Just stop this for now.
}
if (!carrier()) return (-1);
NextCommand:
release(); // Release tracks and timer.
flush(); // Eat output.
cputs ("U L 0 T "); // Continuous output.
read (hprot,hisprot); // Make sure protocol is
cputs (hisprot); // whatever defined in
cputs (" W^M"); // the phone directory. Get
// list of who's on.
command = "Command:"; // Set MBBS command prompt.
write (prompt,command);
t1 = track (command,0); // Use it for tracking.
t2 = track ("ter enabl",0); // Filter still enabled?
t3 = track ("ter disab",0); // Filter disabled?
tmark = timer_start (tol); // Give me a minute.
filter = 1;
while ((stat=trig()) > 0) // Until filter is off:
{ if (stat==t1) // Command:
{ if (!filter) break; // Filter off?
flush();
cputc (219); // Write an ASCII 219 to the port.
filter=cgetct(3)!=219; // Did it return unchanged?
cputc (8); // Delete the ASCII 219 w/ backspace.